package com.hqd.ch03.v50.reader.xml.namespace;

import com.hqd.ch03.v50.beans.factory.config.BeanDefinition;
import com.hqd.ch03.v50.factory.config.BeanDefinitionHolder;
import com.hqd.ch03.v50.reader.xml.ParserContext;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
 * 标签解析注册接口
 */
public interface NamespaceHandler {
    void init();

    /**
     * 解析BeanDefinition自定义标签，eg:
     * <beans>
     * *     <a></a>
     * </beans>
     */
    BeanDefinition parse(Element element, ParserContext context);

    /**
     * 解析bean子标签或者属性，eg:
     * <beans>
     * *     <bean name="xxx"  a="xxx">
     * *         <a></a>
     * *     </bean>
     * </beans>
     */
    BeanDefinitionHolder decorate(Node source, BeanDefinitionHolder definition);
}
